#!/bin/bash

# Set environmental variables
#source PRIMEENV
#export ISPD_CONTEST_ROOT=/users/lmin/min-proj/ISPD_Contest
export ISPD_CONTEST_ROOT=/users/lmin/gate-sizing/GateSizing/
export ISPD_CONTEST_BENCHMARK=$1
#export PRIME_TIME_DIR=/group/ece/davoodi/synopsys/primetime/bin
#export APP_ROOT=/group/ece/davoodi/synopsys.cae/primetime
#export APP_ROOT=/filespace/groups/ece/davoodi/synopsys/F-2011.12
#export APP_ROOT=/filespace/groups/ece/davoodi/synopsys.cae/F-2011.06-SP1.primetime/
export APP_ROOT=/usr/local/
export APP_ENV=${APP_ROOT}/env
export PRIME_TIME_DIR=${APP_ROOT}/bin
#export PRIME_TIME_DIR="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/opt/bin:${APP_ROOT}/bin"
#export PRIME_TIME_DIR=/group/ece/davoodi/synopsys.cae/primetime/bin
#export SIZER_DIR=/users/lmin/min-proj/ISPD_Contest/sizer-v1.0
export SIZER_DIR=/users/lmin/gate-sizing/GateSizing/sizer-v1.0/src

# Run the timer.tcl

tclsh timer.tcl $PRIME_TIME_DIR/pt_shell &


echo "Benchmark name is "
echo $1

# Run test_timer

cd $SIZER_DIR

#make -B
echo "ROOT is "
echo $ISPD_CONTEST_ROOT
echo "Benchmark is "
echo $ISPD_CONTEST_BENCHMARK

#$2 ./sizer
$2 ./sizer $ISPD_CONTEST_ROOT $ISPD_CONTEST_BENCHMARK


# Shutdown the timer

cd $ISPD_CONTEST_ROOT
tclsh shuttimer.tcl

echo "Finished timing analysis"

exit 0

